import Vue from 'vue';
import App from './App.vue';

import Home from './components/Home.vue'
import Shop from './components/Shop.vue'
import Order from './components/Order.vue'
import NotFound from './components/NotFound.vue'

import VueRouter from 'vue-router';
const router = new VueRouter({
  // 路由表
  routes: [
    {
      path: '/a/:name/b/:age',
      component: Home,
    },
    {
      // /c/10 /c/20
      // http://localhost:8080/#/c/10
      // route
      path: '/c/:id',
      component: Shop,
    },
    {
      path: '/e/f',
      component: Order,
    },
    {
      path: '*', // 匹配一切
      component: NotFound,
    },
  ]
});
// 注册组件 <router-view> <router-link>
Vue.use(VueRouter);

new Vue({
  el: '#app',
  router,//路由表
  render: h => h(App),
});